<?php
require_once('./Controller.php');
require_once('../models/Content.php');

class IndexController extends Controller{

    public function index(){
        if(isset($_SESSION['username']) && isset($_SESSION['userid'])){

            //查询blog里面的数据
            $model = new Content();
            //查询出来的使用数据
            $arr = $model -> getAll();



            $url = '../views/blog.html';
            $info = [
                'id' => $_SESSION['userid'],
                'username' => $_SESSION['username'],
            ];

            $data = [
                'info' => $info,
                'arr' => $arr,
            ];

//            $this->dd($data);
            $this->view($url,$data);
        }
        else{
            $url = '../views/login.html';

            $this->redirect($url);
        }
    }


}

$index = new IndexController();
$index->index();


